<!doctype html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="UTF-8">
        <title>酒店管理后台系统</title>
        <meta name="renderer" content="webkit|ie-comp|ie-stand">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <meta http-equiv="Cache-Control" content="no-siteapp" />
        <link rel="stylesheet" href="./css/font.css" th:href="@{/css/font.css}">
        <link rel="stylesheet" href="./css/xadmin.css" th:href="@{/css/xadmin.css}">
        <link rel="stylesheet" href="./css/theme49.min.css" th:href="@{/css/theme49.min.css}">
        <!-- <link rel="stylesheet" href="./css/theme5.css"> -->
        <script src="./lib/layui/layui.js" charset="utf-8" th:src="@{/lib/layui/layui.js}"></script>
        <script type="text/javascript" src="./js/xadmin.js" th:src="@{/js/xadmin.js}"></script>
        <script th:src="@{/js/jquery.min.js}"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
        <script>
            // 是否开启刷新记忆tab功能
            // var is_remember = false;
        </script>
    </head>
    <body class="index">
        <!-- 顶部开始 -->
        <div class="container">
            <div class="logo">
                <a href="./index.html">酒店管理后台操作系统</a></div>
            <div class="left_open">
                <a><i title="展开左侧栏" class="iconfont">&#xe699;</i></a>
            </div>
            <ul class="layui-nav right" lay-filter="">
                <li class="layui-nav-item">
                    <a href="javascript:;" th:text="${session.employee.name}">admin</a>
                    <dl class="layui-nav-child">
                        <!-- 二级菜单 -->
                        <dd>
                            <a href="javascript:;" id="editHref" th:edit-id="${session.employee.id}">修改信息</a></dd>
                        <dd>
                            <a href="" th:href="@{/loginOut}">注销</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item to-index">
                    <a th:href="@{/initPage}">前台首页</a>
                </li>
            </ul>
        </div>
        <!-- 顶部结束 -->
        <!-- 中部开始 -->
        <!-- 左侧菜单开始 -->
        <div class="left-nav">
            <div id="side-nav">
                <ul id="nav">
                    <li>
                        <a href="javascript:;">
                            <i class="iconfont left-nav-li" lay-tips="会员管理">&#xe6b8;</i>
                            <cite>客房管理</cite>
                            <i class="iconfont nav_right">&#xe697;</i></a>
                        <ul class="sub-menu">
                            <li>
                                <a onclick="xadmin.add_tab('客房类型','openHouseType')">
                                    <i class="iconfont">&#xe6a7;</i>
                                    <cite>客房类型</cite></a>
                            </li>
                            <li>
                                <a onclick="xadmin.add_tab('客房信息','openHouse')">
                                    <i class="iconfont">&#xe6a7;</i>
                                    <cite>客房信息</cite></a>
                            </li>
                            <li>
                                <a onclick="xadmin.add_tab('客房订单','openOrder')">
                                    <i class="iconfont">&#xe6a7;</i>
                                    <cite>客房订单</cite></a>
                            </li>
                            <li>
                                <a onclick="xadmin.add_tab('餐品订单','openProductOrder')">
                                    <i class="iconfont">&#xe6a7;</i>
                                    <cite>餐品订单</cite></a>
                            </li>
                            <li>
                                <a onclick="xadmin.add_tab('退房操作','openCheckOut')">
                                    <i class="iconfont">&#xe6a7;</i>
                                    <cite>退房操作</cite></a>
                            </li>

                        </ul>
                    </li>
                    <li>
                        <a href="javascript:;">
                            <i class="iconfont left-nav-li" lay-tips="客户管理">&#xe6af;</i>
                            <cite>用户管理</cite>
                            <i class="iconfont nav_right">&#xe697;</i></a>
                        <ul class="sub-menu">
                            <!--前台客户管理-->
                            <li>
                                <a onclick="xadmin.add_tab('客户列表','openClient')">
                                    <i class="iconfont">&#xe6a7;</i>
                                    <cite>客户列表</cite></a>
                            </li>
                            <!--后台用户管理-->
                            <li th:if="${session.employee.powerId == 0}">
                                <a onclick="xadmin.add_tab('收银员工管理','openEmployee')">
                                    <i class="iconfont">&#xe6a7;</i>
                                    <cite>收银员工管理</cite></a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="javascript:;">
                            <i class="iconfont left-nav-li" lay-tips="后厨管理">&#xe756;</i>
                            <cite>后厨管理</cite>
                            <i class="iconfont nav_right">&#xe697;</i></a>
                        <ul class="sub-menu">
                            <li>
                                <a onclick="xadmin.add_tab('菜品列表','openDishes')">
                                    <i class="iconfont">&#xe6a7;</i>
                                    <cite>菜品列表</cite></a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="javascript:;">
                            <i class="iconfont left-nav-li" lay-tips="库存管理">&#xe6b4;</i>
                            <cite>库存管理</cite>
                            <i class="iconfont nav_right">&#xe697;</i></a>
                        <ul class="sub-menu">
                            <li>
                                <a onclick="xadmin.add_tab('商品列表','openProduct')">
                                    <i class="iconfont">&#xe6a7;</i>
                                    <cite>商品列表</cite></a>
                            </li>
                            <li>
                                <a onclick="xadmin.add_tab('商品类型','openProductType')">
                                    <i class="iconfont">&#xe6a7;</i>
                                    <cite>商品类型</cite></a>
                            </li>
                            <li>
                                <a onclick="xadmin.add_tab('商品采购','openPurchase')">
                                    <i class="iconfont">&#xe6a7;</i>
                                    <cite>商品采购</cite></a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="javascript:;">
                            <i class="iconfont left-nav-li" lay-tips="报表">&#xe723;</i>
                            <cite>报表</cite>
                            <i class="iconfont nav_right">&#xe697;</i></a>
                        <ul class="sub-menu">
                            <li>
                                <a onclick="xadmin.add_tab('营业日报表','openBusiness')">
                                    <i class="iconfont">&#xe6a7;</i>
                                    <cite>营业报表</cite></a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="javascript:;">
                            <i class="iconfont left-nav-li" lay-tips="连锁管理">&#xe828;</i>
                            <cite>连锁管理</cite>
                            <i class="iconfont nav_right">&#xe697;</i></a>
                        <ul class="sub-menu">
                            <li>
                                <a onclick="xadmin.add_tab('连锁管理','openMultiple')">
                                    <i class="iconfont">&#xe6a7;</i>
                                    <cite>连锁管理</cite></a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
        <!-- 左侧菜单结束 -->
        <!-- 右侧主体开始 -->
        <div class="page-content">
            <div class="layui-tab tab" lay-filter="xbs_tab" lay-allowclose="false">
                <ul class="layui-tab-title">
                    <li class="home">
                        <i class="layui-icon">&#xe68e;</i>我的桌面</li></ul>
                <div class="layui-unselect layui-form-select layui-form-selected" id="tab_right">
                    <dl>
                        <dd data-type="this">关闭当前</dd>
                        <dd data-type="other">关闭其它</dd>
                        <dd data-type="all">关闭全部</dd></dl>
                </div>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <iframe src='../welcome.html' th:src="@{welcome}" frameborder="0" scrolling="yes" class="x-iframe"></iframe>
                    </div>
                </div>
                <div id="tab_show"></div>
            </div>
        </div>
        <div class="page-content-bg"></div>
        <style id="theme_style"></style>
    </body>

    <script th:src="@{/js/clickMenthod.js}"></script>
    <script>
        /**
         *修改密码
         */
        $("#editHref").click(function () {
            updateInfo(1, $("#editHref").attr("edit-id"), "employee");
        });

        layui.use(['layer'],function () {


            var websocket = null;
            //获取路径
            var host = document.location.host;
            //获取路径
            var pathName=window.document.location.pathname;
            //截取，得到项目名称
            var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
            if ('WebSocket' in window) {
                websocket = new WebSocket("ws://"+host+projectName+"/websocket");
            } else {
                layer.open({
                    title: '错误消息'
                    , content: '您的浏览器暂不支持WebSocket，您将无法及时接收到前台推送的订单消息提示，解决办法：1. 更换其他浏览器 2. 更新您的浏览器'
                    , skin: 'layui-layer-lan'
                    , shade: 0
                    , icon: 5
                    , anim: 6
                    , closeBtn: 0
                });
            }

            //连接发生错误的回调方法
            websocket.onerror = function () {
                console.log("WebSocket连接发生错误");
            };

            //连接成功建立的回调方法
            websocket.onopen = function () {
                console.log("WebSocket连接成功");
            };

            //接收到消息的回调方法
            websocket.onmessage = function (event) {
                setMessageInnerHTML(event.data);
            };

            //连接关闭的回调方法
            websocket.onclose = function () {
                console.log("WebSocket连接关闭");
            };

            //监听窗口关闭事件，当窗口关闭时，主动去关闭websocket连接，防止连接还没断开就关闭窗口，server端会抛异常。
            window.onbeforeunload = function () {
                closeWebSocket();
            };

            //将消息显示在网页上
            function setMessageInnerHTML(innerHTML) {
                console.log(innerHTML);
                layer.open({
                    title: '温馨提示'
                    , content: '您收到了一条新的通知：<span style="color: red">'+innerHTML+'</span>'
                    , skin: 'layui-layer-lan'
                    , shade: 0.3
                    , icon: 6
                    , anim: 6
                    , closeBtn: 0
                });
            }

            //关闭WebSocket连接
            function closeWebSocket() {
                websocket.close();
            }
        });
    </script>
</html>